<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html" charset="UTF-8">
<title>BufferedStreamFeeder (PNGJ 2.1.0-SNAPSHOT API)</title>
<link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style">
</head>
<body>
<script type="text/javascript"><!--
    if (location.href.indexOf('is-external=true') == -1) {
        parent.document.title="BufferedStreamFeeder (PNGJ 2.1.0-SNAPSHOT API)";
    }
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar_top">
<!--   -->
</a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow">
<!--   -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/BufferedStreamFeeder.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../index-all.html">Index</a></li>
<li><a href="../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev Class</li>
<li><a href="../../../../ar/com/hjg/pngj/ChunkReader.html" title="class in ar.com.hjg.pngj"><span class="strong">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../index.html?ar/com/hjg/pngj/BufferedStreamFeeder.html" target="_top">Frames</a></li>
<li><a href="BufferedStreamFeeder.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
  allClassesLink = document.getElementById("allclasses_navbar_top");
  if(window==top) {
    allClassesLink.style.display = "block";
  }
  else {
    allClassesLink.style.display = "none";
  }
  //-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li><a href="#constructor_summary">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method_summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li><a href="#constructor_detail">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method_detail">Method</a></li>
</ul>
</div>
<a name="skip-navbar_top">
<!--   -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<!-- ======== START OF CLASS DATA ======== -->
<div class="header">
<div class="subTitle">ar.com.hjg.pngj</div>
<h2 title="Class BufferedStreamFeeder" class="title">Class BufferedStreamFeeder</h2>
</div>
<div class="contentContainer">
<ul class="inheritance">
<li><a href="http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">java.lang.Object</a></li>
<li>
<ul class="inheritance">
<li>ar.com.hjg.pngj.BufferedStreamFeeder</li>
</ul>
</li>
</ul>
<div class="description">
<ul class="blockList">
<li class="blockList">
<hr>
<br>
<pre>public class <span class="strong">BufferedStreamFeeder</span>
extends <a href="http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a></pre>
<div class="block">Reads bytes from an input stream, and feeds a IBytesConsumer.</div>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor_summary">
<!--   -->
</a>
<h3>Constructor Summary</h3>
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Constructor Summary table, listing constructors, and an explanation">
<caption><span>Constructors</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colOne" scope="col">Constructor and Description</th>
</tr>
<tr class="altColor">
<td class="colOne"><code><strong><a href="../../../../ar/com/hjg/pngj/BufferedStreamFeeder.html#BufferedStreamFeeder(java.io.InputStream)">BufferedStreamFeeder</a></strong>(<a href="http://docs.oracle.com/javase/1.5.0/docs/api/java/io/InputStream.html?is-external=true" title="class or interface in java.io">InputStream</a>&nbsp;is)</code>
<div class="block">By default, the stream will be closed on close()</div>
</td>
</tr>
<tr class="rowColor">
<td class="colOne"><code><strong><a href="../../../../ar/com/hjg/pngj/BufferedStreamFeeder.html#BufferedStreamFeeder(java.io.InputStream, int)">BufferedStreamFeeder</a></strong>(<a href="http://docs.oracle.com/javase/1.5.0/docs/api/java/io/InputStream.html?is-external=true" title="class or interface in java.io">InputStream</a>&nbsp;is,
                    int&nbsp;bufsize)</code>&nbsp;</td>
</tr>
</table>
</li>
</ul>
<!-- ========== METHOD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="method_summary">
<!--   -->
</a>
<h3>Method Summary</h3>
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
<caption><span>Methods</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../../ar/com/hjg/pngj/BufferedStreamFeeder.html#close()">close</a></strong>()</code>
<div class="block">Closes this object.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>int</code></td>
<td class="colLast"><code><strong><a href="../../../../ar/com/hjg/pngj/BufferedStreamFeeder.html#feed(ar.com.hjg.pngj.IBytesConsumer)">feed</a></strong>(<a href="../../../../ar/com/hjg/pngj/IBytesConsumer.html" title="interface in ar.com.hjg.pngj">IBytesConsumer</a>&nbsp;consumer)</code>
<div class="block">Feeds bytes to the consumer <br>
 Returns bytes actually consumed <br>
 This should return 0 only if the stream is EOF or the consumer is done</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>int</code></td>
<td class="colLast"><code><strong><a href="../../../../ar/com/hjg/pngj/BufferedStreamFeeder.html#feed(ar.com.hjg.pngj.IBytesConsumer, int)">feed</a></strong>(<a href="../../../../ar/com/hjg/pngj/IBytesConsumer.html" title="interface in ar.com.hjg.pngj">IBytesConsumer</a>&nbsp;consumer,
    int&nbsp;maxbytes)</code>
<div class="block">Feeds the consumer (with at most maxbytes) <br>
 This should return 0 only if the stream is EOF or the consumer is done</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>boolean</code></td>
<td class="colLast"><code><strong><a href="../../../../ar/com/hjg/pngj/BufferedStreamFeeder.html#feedFixed(ar.com.hjg.pngj.IBytesConsumer, int)">feedFixed</a></strong>(<a href="../../../../ar/com/hjg/pngj/IBytesConsumer.html" title="interface in ar.com.hjg.pngj">IBytesConsumer</a>&nbsp;consumer,
         int&nbsp;nbytes)</code>
<div class="block">Feeds exactly nbytes, retrying if necessary</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code><a href="http://docs.oracle.com/javase/1.5.0/docs/api/java/io/InputStream.html?is-external=true" title="class or interface in java.io">InputStream</a></code></td>
<td class="colLast"><code><strong><a href="../../../../ar/com/hjg/pngj/BufferedStreamFeeder.html#getStream()">getStream</a></strong>()</code>
<div class="block">Returns inputstream</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>boolean</code></td>
<td class="colLast"><code><strong><a href="../../../../ar/com/hjg/pngj/BufferedStreamFeeder.html#hasMoreToFeed()">hasMoreToFeed</a></strong>()</code>
<div class="block">Returuns true if we have more data to fed the consumer.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>boolean</code></td>
<td class="colLast"><code><strong><a href="../../../../ar/com/hjg/pngj/BufferedStreamFeeder.html#isEof()">isEof</a></strong>()</code>&nbsp;</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>protected void</code></td>
<td class="colLast"><code><strong><a href="../../../../ar/com/hjg/pngj/BufferedStreamFeeder.html#refillBuffer()">refillBuffer</a></strong>()</code>
<div class="block">If there are not pending bytes to be consumed tries to fill the buffer with bytes from the stream.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../../ar/com/hjg/pngj/BufferedStreamFeeder.html#setCloseStream(boolean)">setCloseStream</a></strong>(boolean&nbsp;closeStream)</code>&nbsp;</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../../ar/com/hjg/pngj/BufferedStreamFeeder.html#setFailIfNoFeed(boolean)">setFailIfNoFeed</a></strong>(boolean&nbsp;failIfNoFeed)</code>
<div class="block">If this flag is set (default: false), any call to feed() that returns zero (no byte feed) will throw an exception.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../../ar/com/hjg/pngj/BufferedStreamFeeder.html#setInputStream(java.io.InputStream)">setInputStream</a></strong>(<a href="http://docs.oracle.com/javase/1.5.0/docs/api/java/io/InputStream.html?is-external=true" title="class or interface in java.io">InputStream</a>&nbsp;is)</code>
<div class="block">Sets a new underlying inputstream.</div>
</td>
</tr>
</table>
<ul class="blockList">
<li class="blockList"><a name="methods_inherited_from_class_java.lang.Object">
<!--   -->
</a>
<h3>Methods inherited from class&nbsp;java.lang.<a href="http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a></h3>
<code><a href="http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/Object.html?is-external=true#clone()" title="class or interface in java.lang">clone</a>, <a href="http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/Object.html?is-external=true#equals(java.lang.Object)" title="class or interface in java.lang">equals</a>, <a href="http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/Object.html?is-external=true#finalize()" title="class or interface in java.lang">finalize</a>, <a href="http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/Object.html?is-external=true#getClass()" title="class or interface in java.lang">getClass</a>, <a href="http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/Object.html?is-external=true#hashCode()" title="class or interface in java.lang">hashCode</a>, <a href="http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/Object.html?is-external=true#notify()" title="class or interface in java.lang">notify</a>, <a href="http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/Object.html?is-external=true#notifyAll()" title="class or interface in java.lang">notifyAll</a>, <a href="http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/Object.html?is-external=true#toString()" title="class or interface in java.lang">toString</a>, <a href="http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/Object.html?is-external=true#wait()" title="class or interface in java.lang">wait</a>, <a href="http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/Object.html?is-external=true#wait(long)" title="class or interface in java.lang">wait</a>, <a href="http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/Object.html?is-external=true#wait(long, int)" title="class or interface in java.lang">wait</a></code></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor_detail">
<!--   -->
</a>
<h3>Constructor Detail</h3>
<a name="BufferedStreamFeeder(java.io.InputStream)">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>BufferedStreamFeeder</h4>
<pre>public&nbsp;BufferedStreamFeeder(<a href="http://docs.oracle.com/javase/1.5.0/docs/api/java/io/InputStream.html?is-external=true" title="class or interface in java.io">InputStream</a>&nbsp;is)</pre>
<div class="block">By default, the stream will be closed on close()</div>
</li>
</ul>
<a name="BufferedStreamFeeder(java.io.InputStream, int)">
<!--   -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>BufferedStreamFeeder</h4>
<pre>public&nbsp;BufferedStreamFeeder(<a href="http://docs.oracle.com/javase/1.5.0/docs/api/java/io/InputStream.html?is-external=true" title="class or interface in java.io">InputStream</a>&nbsp;is,
                    int&nbsp;bufsize)</pre>
</li>
</ul>
</li>
</ul>
<!-- ============ METHOD DETAIL ========== -->
<ul class="blockList">
<li class="blockList"><a name="method_detail">
<!--   -->
</a>
<h3>Method Detail</h3>
<a name="getStream()">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getStream</h4>
<pre>public&nbsp;<a href="http://docs.oracle.com/javase/1.5.0/docs/api/java/io/InputStream.html?is-external=true" title="class or interface in java.io">InputStream</a>&nbsp;getStream()</pre>
<div class="block">Returns inputstream</div>
<dl><dt><span class="strong">Returns:</span></dt><dd>Input Stream from which bytes are read</dd></dl>
</li>
</ul>
<a name="feed(ar.com.hjg.pngj.IBytesConsumer)">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>feed</h4>
<pre>public&nbsp;int&nbsp;feed(<a href="../../../../ar/com/hjg/pngj/IBytesConsumer.html" title="interface in ar.com.hjg.pngj">IBytesConsumer</a>&nbsp;consumer)</pre>
<div class="block">Feeds bytes to the consumer <br>
 Returns bytes actually consumed <br>
 This should return 0 only if the stream is EOF or the consumer is done</div>
</li>
</ul>
<a name="feed(ar.com.hjg.pngj.IBytesConsumer, int)">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>feed</h4>
<pre>public&nbsp;int&nbsp;feed(<a href="../../../../ar/com/hjg/pngj/IBytesConsumer.html" title="interface in ar.com.hjg.pngj">IBytesConsumer</a>&nbsp;consumer,
       int&nbsp;maxbytes)</pre>
<div class="block">Feeds the consumer (with at most maxbytes) <br>
 This should return 0 only if the stream is EOF or the consumer is done</div>
</li>
</ul>
<a name="feedFixed(ar.com.hjg.pngj.IBytesConsumer, int)">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>feedFixed</h4>
<pre>public&nbsp;boolean&nbsp;feedFixed(<a href="../../../../ar/com/hjg/pngj/IBytesConsumer.html" title="interface in ar.com.hjg.pngj">IBytesConsumer</a>&nbsp;consumer,
                int&nbsp;nbytes)</pre>
<div class="block">Feeds exactly nbytes, retrying if necessary</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>consumer</code> - Consumer</dd><dd><code>nbytes</code> - Number of bytes</dd>
<dt><span class="strong">Returns:</span></dt><dd>true if success, false otherwise (EOF on stream, or consumer is done)</dd></dl>
</li>
</ul>
<a name="refillBuffer()">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>refillBuffer</h4>
<pre>protected&nbsp;void&nbsp;refillBuffer()</pre>
<div class="block">If there are not pending bytes to be consumed tries to fill the buffer with bytes from the stream.</div>
</li>
</ul>
<a name="hasMoreToFeed()">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>hasMoreToFeed</h4>
<pre>public&nbsp;boolean&nbsp;hasMoreToFeed()</pre>
<div class="block">Returuns true if we have more data to fed the consumer. This internally tries to grabs more bytes from the stream if necessary</div>
</li>
</ul>
<a name="setCloseStream(boolean)">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setCloseStream</h4>
<pre>public&nbsp;void&nbsp;setCloseStream(boolean&nbsp;closeStream)</pre>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>closeStream</code> - If true, the underlying stream will be closed on when close() is called</dd></dl>
</li>
</ul>
<a name="close()">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>close</h4>
<pre>public&nbsp;void&nbsp;close()</pre>
<div class="block">Closes this object.
 
 Sets EOF=true, and closes the stream if <tt>closeStream</tt> is true
 
 This can be called internally, or from outside.
 
 Idempotent, secure, never throws exception.</div>
</li>
</ul>
<a name="setInputStream(java.io.InputStream)">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setInputStream</h4>
<pre>public&nbsp;void&nbsp;setInputStream(<a href="http://docs.oracle.com/javase/1.5.0/docs/api/java/io/InputStream.html?is-external=true" title="class or interface in java.io">InputStream</a>&nbsp;is)</pre>
<div class="block">Sets a new underlying inputstream. This allows to reuse this object. The old underlying is not closed and the state is not reset (you should call close() previously if you
 want that)</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>is</code> - </dd></dl>
</li>
</ul>
<a name="isEof()">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>isEof</h4>
<pre>public&nbsp;boolean&nbsp;isEof()</pre>
<dl><dt><span class="strong">Returns:</span></dt><dd>EOF on stream, or close() was called</dd></dl>
</li>
</ul>
<a name="setFailIfNoFeed(boolean)">
<!--   -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>setFailIfNoFeed</h4>
<pre>public&nbsp;void&nbsp;setFailIfNoFeed(boolean&nbsp;failIfNoFeed)</pre>
<div class="block">If this flag is set (default: false), any call to feed() that returns zero (no byte feed) will throw an exception. This is useful to be sure of avoid infinite loops in some
 scenarios.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>failIfNoFeed</code> - </dd></dl>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
<!-- ========= END OF CLASS DATA ========= -->
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar_bottom">
<!--   -->
</a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow">
<!--   -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/BufferedStreamFeeder.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../index-all.html">Index</a></li>
<li><a href="../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev Class</li>
<li><a href="../../../../ar/com/hjg/pngj/ChunkReader.html" title="class in ar.com.hjg.pngj"><span class="strong">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../index.html?ar/com/hjg/pngj/BufferedStreamFeeder.html" target="_top">Frames</a></li>
<li><a href="BufferedStreamFeeder.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
  allClassesLink = document.getElementById("allclasses_navbar_bottom");
  if(window==top) {
    allClassesLink.style.display = "block";
  }
  else {
    allClassesLink.style.display = "none";
  }
  //-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li><a href="#constructor_summary">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method_summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li><a href="#constructor_detail">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method_detail">Method</a></li>
</ul>
</div>
<a name="skip-navbar_bottom">
<!--   -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<p class="legalCopy"><small>Copyright &#169; 2014. All rights reserved.</small></p>
</body>
</html>
